<template>
	  <transition name="fade">

						<!--<div class="position-horizontal-demo" v-for="(item,index) in classList" @click="selectClass(item)">
							<span class="vux-close">
									{{item.deptName}}
							</span>
						</div>-->
							<div class="newlist" style="height:75vh">
				<!--<x-header title="选择被检查单位"></x-header>-->
										<div class="tree-menu" style="background: #fff">
												<ul class="showul" v-for="(menuItem,index) in data" :key="index">
													 <my-tree :model="menuItem"  :type="type" :name="name"></my-tree>
												</ul>
									 </div>
							</div>

      </transition>
</template>

<script>
//  import testData from './testdata';
  import myTree from './treemenu';
import { XHeader,Tabbar, TabbarItem, Group, Cell ,TransferDom, Popup} from 'vux'
export default {
  name: 'App',
  data () {
      return {
        theModel: [],
        userId:"",
        tokenId:"",
        projectId:"",
        userInfo:"",
				// isTree:true,
				// classValue:false,
				// data:[]
      }
 },
   directives:{
     TransferDom
 },
  components: {
    Tabbar,
    TabbarItem,
    Group,
    Cell,
    XHeader,
     myTree,
			Popup

  },
// 	render:(createElement)=>{
// 		 return createElement(
// 		    'h1',"123123"
// 			)
// 	},
	watch:{
// 		classValue(val){
// 			 this.$emit("update:classValue",val);
//        this.$forceUpdate();
// 		}
	},
	props:{
		 data:{
			  type:Array,
				default:[]
		 },
		 classValue:{
			 type:Boolean,
			 default:false,
		 },
		 name:{
			 type:String,
			 default:'Name',
		 },
		 type:{
			 type:String,
			 default:"company"
		 }
	},
  created() {
		this.isTree = true;
	},
    mounted(){
        let that = this;
        this.$bridge.registerHandler("setToken", function(data) {
                         that.$store.state.Authorization =
          "Bearer " + data;
          that.isTree = true;
            //这里data ioS返回的是token值(字符串)
        });

        this.connectWebViewJavascriptBridge(function(bridge) {
            bridge.init(function(message, responseCallback) {});

            bridge.registerHandler("setToken", function(data) {
                             that.$store.state.Authorization =
          "Bearer " + data;
           that.isTree = true;
                  //这里data android返回的是token值(字符串)

            });
        });
    },
  methods:{
        connectWebViewJavascriptBridge(callback) {
            if (window.WebViewJavascriptBridge) {
                callback(WebViewJavascriptBridge);
            } else {
                document.addEventListener(
                "WebViewJavascriptBridgeReady",
                function() {
                    callback(WebViewJavascriptBridge);
                },
                false
                );
            }
        }
  },
	destroyed() {
		this.classValue = false;
	}

}
</script>

<style scoped lang="less">
.newlist{
  background-color:#fff;
}
.fade-enter-active,.fade-leave-active{
	 transition:opacity 5s;
}
.fade-enter,.fade-leave-to{
	 opacity: 0;
}
</style>
